<template>
    <section v-loading="loading" class="cms-body">
        <div class="cms-list-header flex-between">
            <el-button type="primary"
                       icon="el-icon-plus"
                       @click="routerLink('/resourceType/add','save',0)"
                       v-perms="'/resourceType/add'"
            >添加
            </el-button>
            <!-- 右操作 -->
            <div>
                <cms-input label="类型名称" v-model="params.typeName"></cms-input>
                <el-button @click="query">查询</el-button>
            </div>
        </div>
        <!-- 表格 -->
        <el-table :data="tableData" stripe style="width: 100%" @selection-change="checkIds">
            <el-table-column type="selection" width="65" align="right"></el-table-column>
            <el-table-column prop="typeName" label="类型名称" align="center"></el-table-column>
            <el-table-column prop="name" label="操作" align="center">
                <div slot-scope="scope">
                    <cms-button type="edit" @click.native="routerLink('/resourceType/edit','update',scope.row.id)"
                                v-perms="'/resourceType/edit'"
                    ></cms-button>
                    <cms-button type="delete" @click.native="deleteBatch($api.resourceTypeDelete,scope.row.id)"
                                v-perms="'/resourceType/delete'"
                    ></cms-button>
                </div>
            </el-table-column>
        </el-table>
        <!-- 表格底部 -->
        <div class="cms-list-footer">
            <div class="cms-left">
                <el-button :disabled="disabled" @click="deleteBatch($api.resourceTypeDelete,ids)"
                           v-perms="'/resourceType/delete'"
                >批量删除
                </el-button>
            </div>
            <!-- cms分页组件 -->
            <cms-pagination :total="total" @change="getPages"></cms-pagination>
        </div>
    </section>
</template>

<script>
    import listMixins from '@/mixins/list'

    export default {
        mixins: [listMixins],
        data() {
            return {
                params: {//只需要业务参数
                    typeName: "",
                    pageNo: "",
                    pageSize: ""
                }
                ,
            };
        },
        created() {
            this.initTableData(this.$api.resourceTypeList, this.params);
        }
    };
</script>

<style>

</style>
